//
//  dataModel.m
//  22-homework-alixingqiu
//
//  Created by dllo on 16/8/13.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "dataModel.h"
#import "actionmodel.h"
#import "twodatamodel.h"
@implementation dataModel

- (void)setValue:(id)value forKey:(NSString *)key {
    [super setValue:value forKey:key];
    if ([key isEqualToString:@"action"]) {
        _action = [actionmodel modelWithDic:value];
    }
    if ([key isEqualToString:@"data"]) {
        NSMutableArray<twodatamodel *> *array  = [NSMutableArray array];
        NSArray *arr = value;
        for (NSDictionary *dic in arr) {
            twodatamodel *model = [twodatamodel modelWithDic:dic];
            [array addObject:model];
        }
        _data = array;
    }
}

- (NSString *)description
{
    return [NSString stringWithFormat:@"%@%@%@", _name, _desc, _data];
}

@end
